<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<script>
		var x=prompt("请输入x的值：");
	 	document.write("x:"+x+"<div>");
		var y=prompt("请输入y的值：");
		document.write("y:"+y+"<div>");
     	var i=1;
		var result=1;
		if(y<0){
			y*= (-1);
			for(;i<=y;i++)
			{
				result *= x;
			}
			result=1/result;
		}
		else{
		    for(;i<=y;i++)
		       {
			      result *= x;
		       }
	    }
		document.write("x的y次方="+result); 
		</script>
	</body>
</html>